<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />
<title>公寓大赏</title>
<script type="text/javascript" src="__PUBLIC__/index/js/jquery-1.8.1.js"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=3MBx3mG3POj2CG1Pd5mhD6Lz"></script>
<style>
	body,body * {margin: 0px;padding: 0px;list-style: none;border: 0px; font-size: 14px; font-family: "黑体";}
	body{ background:#eeeeee ;}
	.clss{ background: #ffffff;margin-bottom: 10px;width: 100%; overflow: hidden;}
	.font{ height: 40px;  color:#666666 ; line-height: 40px; border-bottom: solid 1px #cfcfcf; width: 94%; margin: 0px 3%;}
	span{display: inline; color: #000;}
	.choose{ width: 90%; margin: 10px 5%; overflow: hidden;}
	.choose p{ width: 17%; height: 25px; float: left; color: #777777; border: solid 1px  #777777; margin: 5px 1%; border-radius: 5px; line-height: 25px; text-align: center; background: #fff; font-size: 12px;}
	p.cp{color: #fff;  background: #c99f74;border: solid 1px  #c99f74;}
	.buttom{color: #fff;  background: #c99f74; width: 70%;margin: 100px 15%  0px; height: 30px; text-align:center; line-height: 30px;}
</style>

</head>
<body>
	<div class="clss"><div class="font" style="border-bottom: none; color:#999999 ;">当前定位城市：<span>{$cname}</span></div></div>
	<div class="clss city">
		<div class="font" >切换城市</div>
		<div class="choose citycp">
			<volist name="city" id="data"  key="$key" >	
			<p db="{$data.id}" <if condition=" $data['id'] eq  $cid"> class="cp" </if>> {$data.city}</p>
			</volist>
		</div>
	</div>
 	<div class="clss area">
 		<div class="font">选择区域</div>
 		<div class="choose">
			
		</div>
 	</div>
 	
 	
 	<div class="buttom">确定定位</div>
</body>
<script>
	$(function(){
		
		$cid="{$cid}";
		if($cid!=""){
			citybh();
		}else{
			$('.area').hide();
		}	
		$('.citycp').click(function(){
			citybh();
		});
		clk();
		
		$('.buttom').click(function(){
			$cid=$('.city .cp').attr("db");
			$aid=$('.area .cp').attr("db");
			if($aid==0){
				$url="{:U('Apt/index')}?cid="+$cid;
			}else{
				$url="{:U('Apt/index')}?cid="+$cid+"&aid="+$aid;
			}
			location.href = $url ;
		});
		
		function citybh(){	
			$cid=$('.cp').attr("db");
			$url="{:U('Apt/casarea')}?cid="+$cid;
			$.getJSON($url,function(obj){
				if(obj.s=="true"){
					$('.area').show();
					$list=$(".area .choose");
		 			$list.empty();
		 			$list.append("<p class='cp' db='0'>全部</p> ")
		 			$listval=eval(obj.m);
				for(var i=0;i<$listval.length;i++){
				var html="<p  db='"+$listval[i]['id']+"'>"+$listval[i]['area']+"</p> "
				$list.append(html);
				}	
				clk();
				}else{
					$('.area').hide();
				}				
			});
		}
		
		function clk(){
		$('.choose p').click(function(){
			$(this).addClass("cp");
			$(this).siblings().removeClass("cp"); 
		});
		}
		
		
		
		
		
		
	})
</script>
</html>








